﻿/// <reference path="jquery-2.0.3.js" />
/// <reference path="class.js" />

var htmlFragments = (function () {
    var Fragments = Class.create({
        navigationTab: function (nickname) {
            var html = "<div id='navTab'>" +
            "   <ul>                            " +
            "       <li><a id='articlesLink' href='#/Articles'>Articles</a></li>           " +
            "       <li><a id='myArticlesLink' href='#/MyArticles'>My Articles</a></li>     " +
            "   </ul> Welcome                           " +
             nickname.escape() +
            "!</div>";

            return html;
        },
        articlesTabFrame: function (articles) {
            var html = "<div id='articles'><ul>";
            for (var id in articles) {
                html +=
                    "<li><a data-id='" + articles[id].id +
                    "' href='#/article/'>" +
                    articles[id].title.escape() +
                    "</a></li>";
            }

            html += "</ul></div>";
            return html;
        },
        myArticlesTabFrame: function (articles) {
            var html = "<div id='myArticles'><ul>";
            for (var id in articles) {
                html +=
                    "<li><a data-id='" + articles[id].id +
                    "' href='#/article/'>" +
                    articles[id].title.escape() +
                    "</a></li>";
            }

            html += "</ul><button id='createArticleButton'>Create Article</button></div>";
            return html;
        },
        activeArticleFrame: function (article) {
            var html = "<div id='activeArticle'><h2>" + article.title.escape() +
                "</h2><p>" + article.content.escape() +
                "<div>images</div>" +
                "</p></div";

            return html;
        },
        myActiveArticleFrame: function (article) {
            var html = "<div id='myActiveArticle'>Title: <input id='articleTitle' type='text' value='" + article.title.escape() +
                "'/></br>Content: <textarea id='articleContent'>" + article.content.escape() +
                "</textarea><div>images</div>" +
                "<div id='fine-uploader-basic'></div>" + 
                "<button id='saveArticleButton'>Save</button></div>";

            return html;
        },
        notificationTab: function () {
            var html = "<div id='notificationTab'>notificationTab</div>";

            return html;
        },
        //navigationTab: function (nickname) {
        //    var html = "";

        //    return html;
        //},
        //navigationTab: function (nickname) {
        //    var html = "";

        //    return html;
        //},
    })
    return new Fragments();
}());